package com.dundun.exception;

import com.dundun.common.constants.ErrorCode;
import lombok.Getter;

/**
 * @author wq
 */
@Getter
public class MyException extends RuntimeException {

    private static final long serialVersionUID = 1L;



    /**
     * 异常状态码
     */
    private int code;

    public MyException(int code, String message) {
        super(message);
        this.code = code;
    }


    public MyException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public MyException(ErrorCode errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }

    public int getCode() {
        return code;
    }
}
